/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_vehicule")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvVehicule.findAll", query = "SELECT c FROM CvVehicule c"),
    @NamedQuery(name = "CvVehicule.findByIdvehicule", query = "SELECT c FROM CvVehicule c WHERE c.idvehicule = :idvehicule"),
    @NamedQuery(name = "CvVehicule.findByNumerocgg", query = "SELECT c FROM CvVehicule c WHERE c.numerocgg = :numerocgg"),
    @NamedQuery(name = "CvVehicule.findByNumeroshassis", query = "SELECT c FROM CvVehicule c WHERE c.numeroshassis = :numeroshassis"),
    @NamedQuery(name = "CvVehicule.findByNumeroimatriculation", query = "SELECT c FROM CvVehicule c WHERE c.numeroimatriculation = :numeroimatriculation"),
    @NamedQuery(name = "CvVehicule.findByAnneeconstruction", query = "SELECT c FROM CvVehicule c WHERE c.anneeconstruction = :anneeconstruction"),
    @NamedQuery(name = "CvVehicule.findByPlaceConducteur", query = "SELECT c FROM CvVehicule c WHERE c.placeConducteur = :placeConducteur"),
    @NamedQuery(name = "CvVehicule.findByPlacePassagerdevant", query = "SELECT c FROM CvVehicule c WHERE c.placePassagerdevant = :placePassagerdevant"),
    @NamedQuery(name = "CvVehicule.findByPlacePassagerarriere", query = "SELECT c FROM CvVehicule c WHERE c.placePassagerarriere = :placePassagerarriere"),
    @NamedQuery(name = "CvVehicule.findByApuitete", query = "SELECT c FROM CvVehicule c WHERE c.apuitete = :apuitete"),
    @NamedQuery(name = "CvVehicule.findByCeinture", query = "SELECT c FROM CvVehicule c WHERE c.ceinture = :ceinture"),
    @NamedQuery(name = "CvVehicule.findByCategorievehicule", query = "SELECT c FROM CvVehicule c WHERE c.categorievehicule = :categorievehicule"),
    @NamedQuery(name = "CvVehicule.findByNom", query = "SELECT c FROM CvVehicule c WHERE c.nom = :nom")})
public class CvVehicule implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idvehicule", fetch = FetchType.LAZY)
    private List<CvAffectationbesoin> cvAffectationbesoinList;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idvehicule")
    private Integer idvehicule;
    @Column(name = "numerocgg")
    private String numerocgg;
    @Column(name = "numeroshassis")
    private String numeroshassis;
    @Column(name = "numeroimatriculation")
    private String numeroimatriculation;
    @Column(name = "anneeconstruction")
    private Integer anneeconstruction;
    @Column(name = "place_conducteur")
    private Integer placeConducteur;
    @Column(name = "place_passagerdevant")
    private Integer placePassagerdevant;
    @Column(name = "place_passagerarriere")
    private Integer placePassagerarriere;
    @Column(name = "apuitete")
    private String apuitete;
    @Column(name = "ceinture")
    private String ceinture;
    @Column(name = "categorievehicule")
    private String categorievehicule;
    @Basic(optional = false)
    @Column(name = "nom")
    private String nom;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "cvVehicule", fetch = FetchType.EAGER)
    private CvAdministratifvehicule cvAdministratifvehicule;
    @JoinColumn(name = "typemodel", referencedColumnName = "idcv_typemodel")
    @ManyToOne(fetch = FetchType.EAGER)
    private CvTypemodel typemodel;
    @JoinColumn(name = "cv_model_idmodel", referencedColumnName = "idmodel")
    @ManyToOne(fetch = FetchType.LAZY)
    private CvModel cvModelIdmodel;
    @JoinColumn(name = "cv_marque_idmarque", referencedColumnName = "idmarque")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private CvMarque cvMarqueIdmarque;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cvVehiculeIdvehicule", fetch = FetchType.LAZY)
    private List<CvEvaluationvehicule> cvEvaluationvehiculeList;

    public CvVehicule() {
    }

    public CvVehicule(Integer idvehicule) {
        this.idvehicule = idvehicule;
    }

    public CvVehicule(Integer idvehicule, String categorievehicule, String nom) {
        this.idvehicule = idvehicule;
        this.categorievehicule = categorievehicule;
        this.nom = nom;
    }

    public Integer getIdvehicule() {
        return idvehicule;
    }

    public void setIdvehicule(Integer idvehicule) {
        this.idvehicule = idvehicule;
    }

    public String getNumerocgg() {
        return numerocgg;
    }

    public void setNumerocgg(String numerocgg) {
        this.numerocgg = numerocgg;
    }

    public String getNumeroshassis() {
        return numeroshassis;
    }

    public void setNumeroshassis(String numeroshassis) {
        this.numeroshassis = numeroshassis;
    }

    public String getNumeroimatriculation() {
        return numeroimatriculation;
    }

    public void setNumeroimatriculation(String numeroimatriculation) {
        this.numeroimatriculation = numeroimatriculation;
    }

    public Integer getAnneeconstruction() {
        return anneeconstruction;
    }

    public void setAnneeconstruction(Integer anneeconstruction) {
        this.anneeconstruction = anneeconstruction;
    }

    public Integer getPlaceConducteur() {
        return placeConducteur;
    }

    public void setPlaceConducteur(Integer placeConducteur) {
        this.placeConducteur = placeConducteur;
    }

    public Integer getPlacePassagerdevant() {
        return placePassagerdevant;
    }

    public void setPlacePassagerdevant(Integer placePassagerdevant) {
        this.placePassagerdevant = placePassagerdevant;
    }

    public Integer getPlacePassagerarriere() {
        return placePassagerarriere;
    }

    public void setPlacePassagerarriere(Integer placePassagerarriere) {
        this.placePassagerarriere = placePassagerarriere;
    }

    public String getApuitete() {
        return apuitete;
    }

    public void setApuitete(String apuitete) {
        this.apuitete = apuitete;
    }

    public String getCeinture() {
        return ceinture;
    }

    public void setCeinture(String ceinture) {
        this.ceinture = ceinture;
    }

    public String getCategorievehicule() {
        return categorievehicule;
    }

    public void setCategorievehicule(String categorievehicule) {
        this.categorievehicule = categorievehicule;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public CvAdministratifvehicule getCvAdministratifvehicule() {
        return cvAdministratifvehicule;
    }

    public void setCvAdministratifvehicule(CvAdministratifvehicule cvAdministratifvehicule) {
        this.cvAdministratifvehicule = cvAdministratifvehicule;
    }

    public CvTypemodel getTypemodel() {
        return typemodel;
    }

    public void setTypemodel(CvTypemodel typemodel) {
        this.typemodel = typemodel;
    }

    public CvModel getCvModelIdmodel() {
        return cvModelIdmodel;
    }

    public void setCvModelIdmodel(CvModel cvModelIdmodel) {
        this.cvModelIdmodel = cvModelIdmodel;
    }

    public CvMarque getCvMarqueIdmarque() {
        return cvMarqueIdmarque;
    }

    public void setCvMarqueIdmarque(CvMarque cvMarqueIdmarque) {
        this.cvMarqueIdmarque = cvMarqueIdmarque;
    }

    @XmlTransient
    @JsonIgnore
    public List<CvEvaluationvehicule> getCvEvaluationvehiculeList() {
        return cvEvaluationvehiculeList;
    }

    public void setCvEvaluationvehiculeList(List<CvEvaluationvehicule> cvEvaluationvehiculeList) {
        this.cvEvaluationvehiculeList = cvEvaluationvehiculeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idvehicule != null ? idvehicule.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvVehicule)) {
            return false;
        }
        CvVehicule other = (CvVehicule) object;
        if ((this.idvehicule == null && other.idvehicule != null) || (this.idvehicule != null && !this.idvehicule.equals(other.idvehicule))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvVehicule[ idvehicule=" + idvehicule + " ]";
    }

    @XmlTransient
    @JsonIgnore
    public List<CvAffectationbesoin> getCvAffectationbesoinList() {
        return cvAffectationbesoinList;
    }

    public void setCvAffectationbesoinList(List<CvAffectationbesoin> cvAffectationbesoinList) {
        this.cvAffectationbesoinList = cvAffectationbesoinList;
    }
    
}
